/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package orm;

import org.orm.*;
import org.hibernate.Query;
import java.util.List;

public class En_logsDAO {
	public static En_logs loadEn_logsByORMID(int lo_id_logs) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return loadEn_logsByORMID(session, lo_id_logs);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs getEn_logsByORMID(int lo_id_logs) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return getEn_logsByORMID(session, lo_id_logs);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByORMID(int lo_id_logs, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return loadEn_logsByORMID(session, lo_id_logs, lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs getEn_logsByORMID(int lo_id_logs, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return getEn_logsByORMID(session, lo_id_logs, lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByORMID(PersistentSession session, int lo_id_logs) throws PersistentException {
		try {
			return (En_logs) session.load(orm.En_logs.class, new Integer(lo_id_logs));
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs getEn_logsByORMID(PersistentSession session, int lo_id_logs) throws PersistentException {
		try {
			return (En_logs) session.get(orm.En_logs.class, new Integer(lo_id_logs));
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByORMID(PersistentSession session, int lo_id_logs, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			return (En_logs) session.load(orm.En_logs.class, new Integer(lo_id_logs), lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs getEn_logsByORMID(PersistentSession session, int lo_id_logs, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			return (En_logs) session.get(orm.En_logs.class, new Integer(lo_id_logs), lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs[] listEn_logsByQuery(String condition, String orderBy) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return listEn_logsByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs[] listEn_logsByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return listEn_logsByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs[] listEn_logsByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
		StringBuffer sb = new StringBuffer("From orm.En_logs as En_logs");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			List list = query.list();
			return (En_logs[]) list.toArray(new En_logs[list.size()]);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs[] listEn_logsByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		StringBuffer sb = new StringBuffer("From orm.En_logs as En_logs");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			query.setLockMode("this", lockMode);
			List list = query.list();
			return (En_logs[]) list.toArray(new En_logs[list.size()]);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByQuery(String condition, String orderBy) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return loadEn_logsByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return loadEn_logsByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
		En_logs[] en_logses = listEn_logsByQuery(session, condition, orderBy);
		if (en_logses != null && en_logses.length > 0)
			return en_logses[0];
		else
			return null;
	}
	
	public static En_logs loadEn_logsByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		En_logs[] en_logses = listEn_logsByQuery(session, condition, orderBy, lockMode);
		if (en_logses != null && en_logses.length > 0)
			return en_logses[0];
		else
			return null;
	}
	
	public static java.util.Iterator iterateEn_logsByQuery(String condition, String orderBy) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return iterateEn_logsByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static java.util.Iterator iterateEn_logsByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		try {
			PersistentSession session = orm.EncriptacionPersistentManager.instance().getSession();
			return iterateEn_logsByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static java.util.Iterator iterateEn_logsByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
		StringBuffer sb = new StringBuffer("From orm.En_logs as En_logs");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			return query.iterate();
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static java.util.Iterator iterateEn_logsByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
		StringBuffer sb = new StringBuffer("From orm.En_logs as En_logs");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			query.setLockMode("this", lockMode);
			return query.iterate();
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs createEn_logs() {
		return new orm.En_logs();
	}
	
	public static boolean save(orm.En_logs en_logs) throws PersistentException {
		try {
			orm.EncriptacionPersistentManager.instance().saveObject(en_logs);
			return true;
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static boolean delete(orm.En_logs en_logs) throws PersistentException {
		try {
			orm.EncriptacionPersistentManager.instance().deleteObject(en_logs);
			return true;
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static boolean refresh(orm.En_logs en_logs) throws PersistentException {
		try {
			orm.EncriptacionPersistentManager.instance().getSession().refresh(en_logs);
			return true;
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static boolean evict(orm.En_logs en_logs) throws PersistentException {
		try {
			orm.EncriptacionPersistentManager.instance().getSession().evict(en_logs);
			return true;
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new PersistentException(e);
		}
	}
	
	public static En_logs loadEn_logsByCriteria(En_logsCriteria en_logsCriteria) {
		En_logs[] en_logses = listEn_logsByCriteria(en_logsCriteria);
		if(en_logses == null || en_logses.length == 0) {
			return null;
		}
		return en_logses[0];
	}
	
	public static En_logs[] listEn_logsByCriteria(En_logsCriteria en_logsCriteria) {
		return en_logsCriteria.listEn_logs();
	}
}
